using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using DAL;
using Entites;
namespace BUS
{
   public class TinhTrangThanhToanBUS
    {
         public static void Insert(TinhTrangThanhToan tttt)
        {
            TinhTrangThanhToanDAL ttttDAL = new TinhTrangThanhToanDAL();
           ttttDAL.Insert(tttt);
        }
        public static void Update(TinhTrangThanhToan tttt)
        {
            TinhTrangThanhToanDAL ttttDAL = new TinhTrangThanhToanDAL();
            ttttDAL.Update(tttt);
        }
        public static void Delete(int iD)
        {
            TinhTrangThanhToanDAL ttttDAL = new TinhTrangThanhToanDAL();
            ttttDAL.Delete(iD);
        }
        public static tbTinhTrangThanhToanCollection Get(string where,
            int pageindex,
            int pagesize,
            string orderby,
            string orderdirection,
            out int total)
        {
            TinhTrangThanhToanDAL ttttDAL = new TinhTrangThanhToanDAL();
            return ttttDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbTinhTrangThanhToanCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            TinhTrangThanhToanDAL ttttDAL = new TinhTrangThanhToanDAL();
            return ttttDAL.Get(cri.Criter, 0, 0, tbTinhTrangThanhToanColumns.MaTTTT.ToString(), OrderDirection.ASC.ToString(), out total);
        }
       public static TinhTrangThanhToan GetByID(int iD)
       {
           int total = 0;
           Criteria cri = new Criteria();
           cri.add(Condition.AND, tbTinhTrangThanhToanColumns.MaTTTT.ToString(), Condition.EQUAL, iD);
           TinhTrangThanhToanDAL ttttDAL = new TinhTrangThanhToanDAL();
           tbTinhTrangThanhToanCollection tinhtrangthanhtoancollection = ttttDAL.Get(cri.Criter,
                 0, 0, tbTinhTrangGiaoHangColumns.MaTTGH.ToString(), OrderDirection.ASC.ToString(), out total);
           if (tinhtrangthanhtoancollection.Count > 0)
               return tinhtrangthanhtoancollection[0];
           return null;
       }
      
        public static tbTinhTrangThanhToanCollection GetLimited(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            TinhTrangThanhToanDAL ttttDAL = new TinhTrangThanhToanDAL();
            return ttttDAL.Get(cri.Criter, 1, number,
             tbTinhTrangThanhToanColumns.MaTTTT.ToString(), OrderDirection.DESC.ToString(), out total);
        }
        public static tbTinhTrangThanhToanCollection GetPromotion(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            TinhTrangThanhToanDAL ttttDAL = new TinhTrangThanhToanDAL();
            return ttttDAL.Get(cri.Criter, 1, number,
               tbTinhTrangThanhToanColumns.MaTTTT.ToString(), OrderDirection.DESC.ToString(), out total);
        }
    }
    
    
 
}
